package com.sky.service.user.impl;

import com.sky.mapper.user.UserSetMealMapper;
import com.sky.pojo.Setmeal;
import com.sky.service.user.UserSetMealService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
@Slf4j
@Service
@RequiredArgsConstructor
public class UserSetMealServiceImpl implements UserSetMealService {
    private final UserSetMealMapper userSetMealMapper;

    /**
     * 根据分类id查询套餐
     * @param categoryId
     * @return
     */
    @Cacheable(value = "SetMeal",key = "#p0.categoryId")
    @Override
    public List<Setmeal> list(Long categoryId) {
        log.info("获取套餐详情，categoryId:{}",categoryId);
        List<Setmeal> list=userSetMealMapper.list(categoryId);
        return list;
    }
}
